<?php
	// UPDATE COUNTER OF THE FILE
	unset ($db);  
	
	if (!($db = mysql_connect("localhost", "web45", "ocarina."))) { 	
		 //die("Cannot connect to database"); 
	} if (!mysql_select_db("usr_web45_3", $db)) { 	
		 //die("Cannot connect to database"); 
	} 
	
	$file_id = $_GET["id"];
	
	if( is_numeric($file_id) ) {
		$query = @mysql_query("SELECT click_counter FROM dropped_files WHERE id = $file_id");
		while($row = @mysql_fetch_array($query, MYSQL_ASSOC))
		{
		    $old_counter = $row['click_counter'];
		}
		
		$new_counter = $old_counter + 1;
		
		$updateIt = "UPDATE dropped_files SET click_counter = $new_counter WHERE id = $file_id";
		$insertnow = mysql_query($updateIt, $db);
	}
?>